<?php
if(!empty($_POST))
{
	$id = $_POST['Id'];
	//判断是否上传新的图片
	if(empty($_FILES['file']['name']))
	{
		
		$fil = selectone('banner',"Id=$id");
		$file = $fil['file'];
		
	}else
	{
		$file = upload($_FILES['file']);
	}

	$_POST['file'] = $file;
	$result = update('banner', $_POST, $id);
	if($result)
	{
		echo '更新成功';
		header('Refresh:1;index.php?a=admin&b=banner&c=index');
		die;
	}else
	{
		echo '更新失败';
		header('Refresh:1;index.php?a=admin&b=banner&c=index');
		die;	
	}
}
$id = $_GET['id'];
$re = selectone('banner','Id='.$id);
$ree = selectAll('banner_cate');
//$banner_cate = getcate($ree);
//die;
include('app/admin/banner/html/update.html');
?>